package org.webrx;

public class MathDemo {
    public static void main(String[] args) {
        int a = 10;
        int b = 7;
        if (args.length == 2) {
            try {
                a = Integer.parseInt(args[0]);
                b = Integer.parseInt(args[1]);
            } catch (Exception e) {
                System.err.println("输入错误，程序退出");
                System.exit(0);
            }
        }
        if (a % b == 0) {
            System.out.printf("%d ÷ %d = %d%n", a, b, a / b);
        } else {
            System.out.printf("%d ÷ %d = %d...%d%n", a, b, a / b, a % b);
        }
    }
}
